Border Padding



Bi-dimensional image padding for spatial filtering and convolution.

0. Input image and Box Filter function


Without padding, the border of the filtered image will receive 0.

1. Zero Padding


Pads with a constant value (0 in this case), resulting in a artifact with the same value on the border.

|A B C D E F|

0 0 0 |A B C D E F| 0 0 0

We can notice a black border on the filtered image.

2. Wrap Padding


Pads with a modular repetition of each axis, resulting in some artifacts from the opposite edges.

|A B C D E F|

D E F |A B C D E F| A B C

We can notice a red artifact on the top of the filtered image which was spread from the bottom part.

3. Reflect Padding


Pads with the reflection of each axis.

|A B C D E F|

D C B |A B C D E F| E D C

4. Edge Padding


Pads with the edge pixel of each axis.

|A B C D E F|

A A A |A B C D E F| F F F